Skip to content

Include Channel Name in server log#206

Open
NicoPiel wants to merge 24 commits intoOpenIntegrationEngine:mainfrom
NicoPiel:feature/logging-improvements
Open

Include Channel Name in server log#206
NicoPiel wants to merge 24 commits intoOpenIntegrationEngine:mainfrom
NicoPiel:feature/logging-improvements

Conversation

@NicoPiel
Copy link
Collaborator

@NicoPiel NicoPiel commented Nov 19, 2025

Changelog:

  1. Server:

    • Modified ServerLogItem to include channelName, updated constructor, getters/setters.
    • Modified ServerLogProvider to pass channelName to ServerLogItem.
    • Modified ArrayAppender to extract channelName and channelId from Log4j ThreadContext.
    • Modified JavaScriptTask to populate ThreadContext with channel info.
  2. Donkey Engine:

    • Modified Channel to populate ThreadContext in dispatch and source queue threads.
    • Modified DestinationChain to populate ThreadContext using channel info.
    • Modified DestinationConnector to populate ThreadContext in queue threads.
  3. Client:

    • Modified ServerLogPanel to add "Channel" column to the UI table.

@NicoPiel NicoPiel force-pushed the feature/logging-improvements branch from 9fce32c to 3c94136 Compare November 20, 2025 14:13
@NicoPiel
Copy link
Collaborator Author

@mgaffigan Thoughts on the map implementation? Did you have this in mind when you suggested a map?

Signed-off-by: Nico Piel <nicopiel@mailbox.org>
Signed-off-by: Nico Piel <nico.piel@hotmail.de>
Signed-off-by: Nico Piel <nicopiel@mailbox.org>
Signed-off-by: Nico Piel <nico.piel@hotmail.de>
Signed-off-by: Nico Piel <nicopiel@mailbox.org>
Signed-off-by: Nico Piel <nico.piel@hotmail.de>
Signed-off-by: Nico Piel <nicopiel@mailbox.org>
Signed-off-by: Nico Piel <nico.piel@hotmail.de>
Signed-off-by: Nico Piel <nicopiel@mailbox.org>
Signed-off-by: Nico Piel <nico.piel@hotmail.de>
Signed-off-by: Nico Piel <nico.piel@hotmail.de>
Signed-off-by: Nico Piel <nico.piel@hotmail.de>
Signed-off-by: Nico Piel <nico.piel@hotmail.de>
Signed-off-by: Nico Piel <nico.piel@hotmail.de>
Signed-off-by: Nico Piel <nico.piel@hotmail.de>
Changes the ArrayAppender to construct a ServerLogItem directly
instead of passing individual log properties.

The ServerLogProvider now accepts a ServerLogItem, extracts the log
properties, adds the server ID and log ID, and then passes the log
item to the log controller.

This change simplifies the code and makes it more efficient by
reducing the number of parameters passed and centralizing the
creation of the ServerLogItem.

Signed-off-by: Nico Piel <nico.piel@hotmail.de>
Ensures that the ServerLogItem properties are initialized with default values when retrieving them from the context.
This prevents null pointer exceptions or unexpected behavior when these properties are not explicitly set in the context.

Signed-off-by: Nico Piel <nico.piel@hotmail.de>
@mgaffigan mgaffigan force-pushed the feature/logging-improvements branch from 2482499 to 53a85d9 Compare November 24, 2025 19:19
Signed-off-by: Nico Piel <nico.piel@hotmail.de>
@NicoPiel NicoPiel force-pushed the feature/logging-improvements branch from a418b01 to 278d2b3 Compare November 24, 2025 20:08
Signed-off-by: Nico Piel <nico.piel@hotmail.de>
@NicoPiel NicoPiel force-pushed the feature/logging-improvements branch from 469b1c1 to b1623c9 Compare November 24, 2025 20:19
Signed-off-by: Nico Piel <nico.piel@hotmail.de>
Signed-off-by: Nico Piel <nico.piel@hotmail.de>
Signed-off-by: Nico Piel <nico.piel@hotmail.de>
Signed-off-by: Nico Piel <nico.piel@hotmail.de>
Signed-off-by: Nico Piel <nico.piel@hotmail.de>
Signed-off-by: Nico Piel <nico.piel@hotmail.de>
Signed-off-by: Nico Piel <nico.piel@hotmail.de>
Signed-off-by: Nico Piel <nico.piel@hotmail.de>
Signed-off-by: Nico Piel <nico.piel@hotmail.de>
@mgaffigan mgaffigan changed the title Logging improvements Include Channel Name in server log Nov 26, 2025
@pacmano1 pacmano1 requested a review from Copilot December 9, 2025 22:22
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds channel name information to server logs by propagating channel context through Log4j's ThreadContext mechanism. The implementation spans three main components: server-side logging infrastructure, the Donkey engine threading model, and the client UI.

Key changes:

  • Modified ServerLogItem to store channel information in an attributes map with convenient getter/setter methods
  • Updated all channel-related thread entry points to populate ThreadContext with channel ID and name using CloseableThreadContext
  • Enhanced the server log UI table to display a new "Channel" column

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 12 comments.

Show a summary per file
File Description
server/src/com/mirth/connect/server/util/javascript/JavaScriptTask.java Added ThreadContext population with channel info in JavaScript task execution
server/src/com/mirth/connect/plugins/serverlog/ServerLogProvider.java Updated method signature to accept attributes map for channel information
server/src/com/mirth/connect/plugins/serverlog/ServerLogItem.java Added attributes map to store channel data with dedicated getter/setter methods
server/src/com/mirth/connect/plugins/serverlog/ArrayAppender.java Modified to extract context data from Log4j events and pass to provider
donkey/src/main/java/com/mirth/connect/donkey/server/channel/DestinationConnector.java Wrapped queue thread execution with ThreadContext for channel info
donkey/src/main/java/com/mirth/connect/donkey/server/channel/DestinationChainProvider.java Added channelName field with getter/setter
donkey/src/main/java/com/mirth/connect/donkey/server/channel/DestinationChain.java Added ThreadContext population in chain execution threads
donkey/src/main/java/com/mirth/connect/donkey/server/channel/Channel.java Updated to set channel name on chain providers and populate ThreadContext in dispatch/queue threads
client/src/com/mirth/connect/plugins/serverlog/ServerLogPanel.java Added "Channel" column to server log table and adjusted column indices

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@tonygermano tonygermano added the enhancement New feature or request label Dec 12, 2025
@NicoPiel NicoPiel requested review from a team, gibson9583, jonbartels, kayyagari, kpalang, pacmano1, ssrowe and tonygermano and removed request for a team March 13, 2026 20:31
Copy link
Contributor

@pacmano1 pacmano1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Firstly, I do like this the change!

However for those of us who already prepend channelName to log messages, IMHO this should be implemtned as an optional feature configurable by default to off via mirth.properties

@mgaffigan
Copy link
Contributor

Firstly, I do like this the change!

However for those of us who already prepend channelName to log messages, IMHO this should be implemtned as an optional feature configurable by default to off via mirth.properties

@pacmano1, that would make this hard to discover for newcomers and the majority of users who don't log servername.

There only seems to be a cosmetic problem if it is enabled by default, and a usability problem if disabled.

Defaults should be based on best practice for the typical new user.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants